package com.hh128.dragonbones;
 
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout.LayoutParams;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity { 
     
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       RelativeLayout root=  findViewById(R.id.bottom);
      
    /* TimeLineView time_line=new TimeLineView(this);
      time_line.setLayoutParams(new LayoutParams(1200,200));
        root.addView(time_line);*/
       Button zoom_add=new Button(this);
       zoom_add.setText("zoom+");
       Button zoom_min=new Button(this);
       zoom_min.setText("zoom-");
       root.addView(zoom_min);
      int id=zoom_add.generateViewId();
      zoom_add.setId(id);
       
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,100);
     
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        zoom_add.setLayoutParams(layoutParams);
        root.addView(zoom_add);
       RelativeLayout.LayoutParams b= new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,100);
       b.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
       int id2=zoom_min.generateViewId();
       zoom_min.setId(id2);
     b.addRule(RelativeLayout.BELOW,id);
     
     
       zoom_min.setLayoutParams(b);
        
        initView(root);
    }
    public void conect(View v)
    {
        Toast.makeText(this,"qq2439905184",Toast.LENGTH_LONG).show();
    }
	private void initView(RelativeLayout root)
    {
        final TextView current_frame=new TextView(this);
        current_frame.setText("当前帧:0");
        
        SeekBar time_bar=new SeekBar(this);
     //   time_bar.setLayoutParams(new LayoutParams(1000,50));
        int id=time_bar.generateViewId();
        time_bar.setId(id);
        RelativeLayout.LayoutParams b= new RelativeLayout.LayoutParams(1000,50);
        b.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,id);
       time_bar.setLayoutParams(b);
       
        root.addView(current_frame); 
        root.addView(time_bar);
        
        time_bar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
            {

                @Override
                public void onProgressChanged(SeekBar p1,int p2,boolean p3)
                {
                    Toast.makeText(getApplicationContext(),"progress"+p2,Toast.LENGTH_SHORT).show();
                    current_frame.setText("当前帧"+p2);
                }

                @Override
                public void onStartTrackingTouch(SeekBar p1)
                {
                }

                @Override
                public void onStopTrackingTouch(SeekBar p1)
                {
                }
                
            
        }
        );
    }
} 
